package com.jcl.recruit.log.mapper;

import com.jcl.recruit.log.model.ConsoleResumeLog;
import com.jcl.recruit.log.vo.LogPageCondition;
import com.jcl.recruit.mapper.SqlMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


public interface ConsoleResumeLogMapper extends SqlMapper {

    @Select({
            QUERY_SCRIPT_START,
            "select a.id as id, a.resume_id as resume_id, a.category as category, a.resume_type as resume_type, ",
            " c.name as name, c.sex as sex, c.birthday as birthday,c.edu_last_education as education, b.source_sub as source_sub,",
            " c.work_last_position as position_name, b.update_date as update_date,d.realname as add_user, ",
            " a.user_id as user_id, a.corp_code as corp_code, a.create_time as create_time ",
            " from resume_log a left join resume_basic_info b on a.resume_id = b.id",
            " left join resume_pers_info c on a.resume_id = c.resume_id  left join user d on a.user_id = d.id ",
            " order by resume_id desc, create_time desc limit #{limitStart}, #{limitEnd} ",
            QUERY_SCRIPT_END
    })
    List<ConsoleResumeLog> findList(String dbServerName,
                                    LogPageCondition condition,
                                    @Param("limitStart") Integer limitStart,
                                    @Param("limitEnd") Integer limitEnd);

    @Select({
            QUERY_SCRIPT_START,
            "select count(a.id) as number from resume_log a left join resume_basic_info b on a.resume_id = b.id",
            " left join resume_pers_info c on a.resume_id = c.resume_id  left join user d on a.user_id = d.id ",
            QUERY_SCRIPT_END
    })
    List<Map<String, Object>> consoleFindCount(String dbServerName, LogPageCondition condition);


}
